package com.hznu.stmanage.serviceImpl;

import com.hznu.stmanage.dao.TeacherMapper;
import com.hznu.stmanage.entity.Teacher;
import com.hznu.stmanage.service.BaseService;
import com.hznu.stmanage.service.TeacherService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by J_Vino on 16/3/6.
 */
@Transactional(rollbackFor = Exception.class)
@Service
public class TeacherServiceImpl extends BaseService implements TeacherService{

    TeacherMapper teacherMapper = null;
    public void setMapper()
    {
        if(teacherMapper==null)
            teacherMapper = getTeacherMapper();//1.获取相关mapper
    }
    public int deleteByPrimaryKey(Long id) {
        setMapper();
        return teacherMapper.deleteByPrimaryKey(id);
    }

    public int insert(Teacher record) {
        setMapper();
        return teacherMapper.insert(record);
    }

    public int insertSelective(Teacher record) {
        setMapper();
        return teacherMapper.insertSelective(record);
    }

    public Teacher selectByPrimaryKey(Long id) {
        setMapper();
        return teacherMapper.selectByPrimaryKey(id);
    }

    public int updateByPrimaryKeySelective(Teacher record) {
        setMapper();
        return teacherMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(Teacher record) {
        setMapper();
        return teacherMapper.updateByPrimaryKey(record);
    }

    public Teacher findByID(String ID) {
        setMapper();
        return teacherMapper.selectByID(ID);
    }
}
